<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>报表管理</title>
<%@ include file="head.jsp"%>
<link id='theme' rel='stylesheet' href='static/css/report.css'/>
</head>
<body>
<div id="report">
<div class="container">
<div class="searchuserdiv ope">
	<ul>
		<li>
		<form action="report/manage" method="post" onsubmit="return searchReportFunc();">
		
		操作类型：
		<select name="reportType" id="reporttype">
		<option value="999" style="background: #333333;padding:3px;color:#fff;">财务报表</option>
		<option value="1" <c:if test="${reportType == 1}">selected="selected"</c:if> style="padding:3px;">	&nbsp;&nbsp;&nbsp;&nbsp;代理商账户余额报表</option>
		<option value="2" <c:if test="${reportType == 2}">selected="selected"</c:if> style="padding:3px;">	&nbsp;&nbsp;&nbsp;&nbsp;预付款流水报表</option>
		<option value="3" <c:if test="${reportType == 3}">selected="selected"</c:if> style="padding:3px;">	&nbsp;&nbsp;&nbsp;&nbsp;代理商流水报表</option>
		<option value="998" style="background: #333333;padding:3px;color:#fff;">产品报表</option>
		<option value="4" <c:if test="${reportType == 4}">selected="selected"</c:if> style="padding:3px;">	&nbsp;&nbsp;&nbsp;&nbsp;产品分类数量/金额汇总</option>
		<option value="997" style="background: #333333;padding:3px;color:#fff;">消费报表</option>
		<option value="6" <c:if test="${reportType == 6}">selected="selected"</c:if> style="padding:3px;">	&nbsp;&nbsp;&nbsp;&nbsp;客户消费汇总(暂无)</option>
		</select>
		<div id="opertime" style="margin-top:-20px; margin-left:280px;">
		操作时间：
		<input style="width:100px;" class="easyui-datebox" size="15" name="starttime" id="starttime" value="<f:formatDate value="${starttime}" pattern="yyyy-MM-dd"/>" type="text" />
		至
		<input style="width:100px;" class="easyui-datebox" size="15" name="endtime" id="endtime" value="<f:formatDate value="${endtime}" pattern="yyyy-MM-dd"/>" type="text" />
		</div>
		<div style="margin-top:-20px; margin-left:580px;">
		<input type="button" value="查询" onclick="search_report()"/>
		</div>
		</form>
		</li>
	</ul>
	
</div>
<c:choose>
	<c:when test="${reportType == 1}">
		<div class="downloadfile">
<ul>
	<li><img src="static/images/pdf.png" /><a href="report/balance/pdf">PDF下载</a></li>
	<li><img src="static/images/excel.png" /><a href="report/balance/excel">Excel下载</a></li>
</ul>
</div>
<h1>代理商余额报表</h1>
<table>
  <thead>
	  <tr>
		  <th>序号</th>
		  <th>代理商名称</th>
		  <th>账户余额</th>
	  </tr>
  </thead>   
  <tbody>
  	<c:if test="${accountList !=null }">
		<c:forEach items="${ accountList}" var = "account" varStatus="status">
		<tr>
			<td>${status.index+1}</td>
			<td>${account.username}</td>
			<td>${account.money }</td>
		</tr>
		</c:forEach>
	</c:if>
</tbody>
</table>
	</c:when>
	<c:when test="${reportType == 2}">
<div class="downloadfile">
<ul>
	<li><img src="static/images/pdf.png" /><a href="report/advancepay/pdf?starttime=<f:formatDate value="${starttime}" pattern="yyyy-MM-dd"/>&endtime=<f:formatDate value="${endtime}" pattern="yyyy-MM-dd"/>">PDF下载</a></li>
	<li><img src="static/images/excel.png" /><a href="report/advancepay/excel?starttime=<f:formatDate value="${starttime}" pattern="yyyy-MM-dd"/>&endtime=<f:formatDate value="${endtime}" pattern="yyyy-MM-dd"/>">Excel下载</a></li>
</ul>
</div>
<h1>预付款流水报表</h1>
<table>
  <thead>
	  <tr>
		  <th>序号</th>
		  <th>代理商名称</th>
		  <th>预付款</th>
		  <th>账户余额</th>
		  <th>备注信息</th>
		  <th>时间</th>
	  </tr>
  </thead>   
  <tbody>
  	<c:if test="${accountDetailList !=null }">
		<c:forEach items="${ accountDetailList}" var = "accountdetail" varStatus="status">
		<tr>
			<td>${status.index+1}</td>
			<td>${accountdetail.username}</td>
			<td>${accountdetail.money }</td>
			<td>${accountdetail.accountmoney }</td>
			<td>${accountdetail.memo }</td>
			<td><f:formatDate value="${accountdetail.detaildatetime }" pattern="yyyy-MM-dd HH:mm:ss"/> </td>
		</tr>
		</c:forEach>
	</c:if>
</tbody>
</table>
	</c:when>
	<c:when test="${reportType == 3}">
<div class="downloadfile">
<ul>
	<li><img src="static/images/pdf.png" /><a href="report/agent/pdf?starttime=<f:formatDate value="${starttime}" pattern="yyyy-MM-dd"/>&endtime=<f:formatDate value="${endtime}" pattern="yyyy-MM-dd"/>">PDF下载</a></li>
	<li><img src="static/images/excel.png" /><a href="report/agent/excel?starttime=<f:formatDate value="${starttime}" pattern="yyyy-MM-dd"/>&endtime=<f:formatDate value="${endtime}" pattern="yyyy-MM-dd"/>">Excel下载</a></li>
</ul>
</div>
<h1>代理商流水报表</h1>
<table>
  <thead>
	  <tr>
		  <th>序号</th>
		  <th>代理商名称</th>
		  <th>预付款</th>
		  <th>账户余额</th>
		  <th>备注信息</th>
		  <th>时间</th>
	  </tr>
  </thead>   
  <tbody>
  	<c:if test="${accountDetailList !=null }">
		<c:forEach items="${ accountDetailList}" var = "accountdetail" varStatus="status">
		<tr>
			<td>${status.index+1}</td>
			<td>${accountdetail.username}</td>
			<td>${accountdetail.money }</td>
			<td>${accountdetail.accountmoney }</td>
			<td>${accountdetail.memo }</td>
			<td><f:formatDate value="${accountdetail.detaildatetime }" pattern="yyyy-MM-dd HH:mm:ss"/> </td>
		</tr>
		</c:forEach>
	</c:if>
</tbody>
</table>
	</c:when>
	<c:when test="${reportType == 4}">
<div class="downloadfile">
<ul>
	<li><img src="static/images/pdf.png" /><a href="report/product/pdf">PDF下载</a></li>
	<li><img src="static/images/excel.png" /><a href="report/product/excel">Excel下载</a></li>
</ul>
</div>
<h1>产品分类数量/金额汇总</h1>
<table>
  <thead>
	  <tr>
		  <th>序号</th>
		  <th>产品分类名称</th>
		  <th>数量</th>
		  <th>价格</th>
	  </tr>
  </thead>   
  <tbody>
	<c:if test="${reportProductList !=null }">
		<c:forEach items="${ reportProductList}" var = "report" varStatus="status">
		<tr>
			<td>${status.index+1}</td>
			<td>${report.configTypeName}</td>
			<td>${report.number }</td>
			<td>${report.price }</td>
		</tr>
		</c:forEach>
	</c:if>
</tbody>
</table>
	</c:when>
</c:choose>
</div>
</div>
<script type="text/javascript" src="static/js/report.js"></script>
</body>
</html>